package com.eversec.util.command;

import info.monitorenter.cpdetector.io.CodepageDetectorProxy;

import java.io.File;
import java.nio.charset.Charset;

public class CharacterEnding {
	
	public static String getFileCharacterEnding(File file) {

		String fileCharacterEnding = "UTF-8";

		CodepageDetectorProxy detector = CodepageDetectorProxy.getInstance
				
				
				();
//		detector.add(JChardetFacade.getInstance());

		Charset charset = null;

		try {
			charset = detector.detectCodepage(file.toURI().toURL());
		} catch (Exception e) {
			e.printStackTrace();
		}
		if (charset != null) {
			fileCharacterEnding = charset.name();
		}

		return fileCharacterEnding;
	}
}
